home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -serious- / programming / other / tandem / teaching / 62.asm < prev    next >
Assembly Source File  |  1999-09-06  |  3KB  |  116 lines

  1. * Teaching/62.asm   Demonstrate Scrollers    0.01   8.6.99
  2.  
  3.  
  4.  include 'Front.i'
  5.  
  6. ; This program is useful, as it shows the IDCMP's that come in
  7. ; as you fiddle with the scrollers.
  8.  
  9.  
  10. * text strings
  11. strings: dc.b 0
  12. st_1: dc.b 'Set up Window with Scrollers',0 ;1
  13.  dc.b 'Out of Chip memory',0 ;2
  14.  dc.b 'Message  IAddress Code Class    Qual MsX  MsY',0 ;3
  15.  dc.b 'This program is about to open a window with scrollers.',0 ;4
  16.  dc.b 'As you fiddle with the scrollers, resize the window, &c,',0 ;5
  17.  dc.b 'you will see on the window the results of each call to',0 ;6
  18.  dc.b 'TLwindow. This should help you to understand how to make',0 ;7
  19.  dc.b 'your programs responsive to scrollers.',0 ;8
  20.  
  21.  ds.w 0
  22.  
  23.  
  24. * set up window with scrollers
  25. Program:
  26.  TLwindow #-1              ;preliminary info
  27.  TLreqinfo #4,#5
  28.  
  29.  TLwindow #0,#0,#0,#600,#180,#640,#200,#-1,#st_1 ;\8=-1 for scrollers
  30.  bne.s Pr_cont
  31.  
  32. Pr_bad:
  33.  TLbad #2
  34.  bra Pr_quit
  35.  
  36. Pr_cont:
  37.  move.l xxp_AcWind(a4),a5
  38.  move.l xxp_scrl(a5),a3
  39.  move.l #32,xxp_hztp(a3)
  40.  move.l #64,xxp_hzvs(a3)
  41.  move.l #256,xxp_hztt(a3)
  42.  move.l #32,xxp_vttp(a3)
  43.  move.l #64,xxp_vtvs(a3)
  44.  move.l #256,xxp_vttt(a3)
  45.  TLwscroll set
  46.  
  47.  TLstring #3,#0,#0
  48.  moveq #0,d7               ;message count
  49.  bsr Wait                  ;wait until close window
  50.  
  51. Pr_quit:
  52.  nop
  53.  nop
  54.  rts
  55.  
  56.  
  57. * wait for close window, show mousemoves
  58. Wait:
  59.  TLwcheck
  60.  beq.s Wt_cu
  61.  TLwupdate
  62. Wt_cu:
  63.  TLkeyboard                ;get response
  64.  
  65.  movem.l d0-d7/a0-a6,-(a7) ;scroll previous messages
  66.  move.l xxp_gfxb(a4),a6
  67.  move.l xxp_AcWind(a4),a5
  68.  move.l xxp_Window(a5),a0
  69.  move.l wd_RPort(a0),a1
  70.  moveq #0,d2
  71.  move.w xxp_LeftEdge(a5),d2
  72.  move.l d2,d4
  73.  add.w #479,d4
  74.  moveq #0,d3
  75.  move.w xxp_TopEdge(a5),d3
  76.  addq.w #8,d3
  77.  move.l d3,d5
  78.  add.w #127,d5
  79.  moveq #0,d0
  80.  moveq #8,d1
  81.  jsr _LVOScrollRaster(a6)
  82.  movem.l (a7)+,d0-d7/a0-a6
  83.  
  84.  move.l xxp_mesg(a4),a1    ;collect message data    d0 = ascii / TL code
  85.  move.l im_IAddress(a1),d5 ;d5 = IAdress            d3 = modified qualifier
  86.  move.l im_Class(a1),d4    ;d4 = class              d1,d2 = mouse / scroller
  87.  
  88.  cmp.b #$93,d0             ;qui if close window
  89.  beq Wt_done
  90.  
  91.  move.l a4,a0              ;show message content
  92.  addq.l #1,d7
  93.  TLhexasc16 d7,#8,a0       ;message count
  94.  move.b #' ',(a0)+
  95.  TLhexasc16 d5,#8,a0       ;IAddress
  96.  move.b #' ',(a0)+
  97.  TLhexasc16 d0,#4,a0       ;ascii / TL code
  98.  move.b #' ',(a0)+
  99.  TLhexasc16 d4,#8,a0       ;class (IDCMP)
  100.  move.b #' ',(a0)+
  101.  TLhexasc16 d3,#4,a0       ;qualifier
  102.  move.b #' ',(a0)+
  103.  
  104.  TLhexasc16 d1,#4,a0       ;show mouse/scroller posn
  105.  move.b #' ',(a0)+
  106.  TLhexasc16 d2,#4,a0
  107.  move.b #' ',(a0)+
  108.  
  109.  clr.b (a0)                ;show data
  110.  TLtext #0,#120
  111.  
  112.  bra Wait                  ;go wait for next message
  113.  
  114. Wt_done:
  115.  rts
  116.